using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace SS
{
	[ToolboxBitmap(typeof(Icon), "ToolIcon")]
	public class EAN13CodeCtl : Control
	{
		private Container components = null;
		private EAN13Code pntr;
		private string m_name = "";
		private string m_price = "";
		private string m_company = "";
		private int m_Width;
		private int m_Height;
		public int X = 20;
		public int Y = 21;
		public string m_Name
		{
			get
			{
				return this.m_name;
			}
			set
			{
				this.m_name = value;
			}
		}
		public string m_Price
		{
			get
			{
				return this.m_price;
			}
			set
			{
				this.m_price = value;
			}
		}
		public string m_Company
		{
			get
			{
				return this.m_company;
			}
			set
			{
				this.m_company = value;
			}
		}
		public new float Scale
		{
			get
			{
				return this.pntr.BrushWidth;
			}
			set
			{
				this.pntr.BrushWidth = value;
				this.pntr.m_Name = this.m_Name;
				this.pntr.m_Price = this.m_Price;
				this.pntr.EANCode = this.Text;
				base.Invalidate();
			}
		}
		public override string Text
		{
			get
			{
				return base.Text;
			}
			set
			{
				base.Text = value;
				if (this.pntr != null)
				{
					this.pntr.EANCode = value;
				}
			}
		}
		public override Color BackColor
		{
			get
			{
				return base.BackColor;
			}
			set
			{
				base.BackColor = value;
				if (this.pntr != null)
				{
					this.pntr.BackColor = value;
				}
			}
		}
		public override Font Font
		{
			get
			{
				return base.Font;
			}
			set
			{
				base.Font = value;
				if (this.pntr != null)
				{
					this.pntr.Font = value;
				}
			}
		}
		public EAN13CodeCtl()
		{
			this.InitializeComponent();
		}
		public EAN13CodeCtl(int _X, int _Y, int _Width, int _Height)
		{
			this.X = _X;
			this.Y = _Y;
			this.m_Width = _Width;
			this.m_Height = _Height;
			this.InitializeComponent();
		}
		public Bitmap GetBitmap()
		{
			return this.pntr.TmpCode;
		}
		protected override void OnPaint(PaintEventArgs e)
		{
			if (this.pntr == null)
			{
				Color bC = Color.FromArgb(255, 255, 255);
				this.pntr = new EAN13Code(this.X, this.Y, base.Width, base.Height, this.Font, bC);
                //this.pntr.CodeChanged += new EventHandler(this.pntr_CodeChanged);
			}
			this.pntr.Render(e.Graphics);
		}
		protected override void OnResize(EventArgs e)
		{
			if (this.pntr != null)
			{
				this.pntr.xPos = this.X;
				this.pntr.yPos = this.Y;
				this.pntr.Width = base.Width;
				this.pntr.Height = base.Height;
				this.pntr.EANCode = this.Text;
			}
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				if (this.components != null)
				{
					this.components.Dispose();
				}
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			base.Name = "UserControl1";
			base.Size = new Size(this.m_Width, this.m_Height);
		}
		private void pntr_CodeChanged(object sender, EventArgs e)
		{
			base.Invalidate(false);
		}
	}
}
